#include "ThreadManager.hpp"

ThreadManager::ThreadManager(void)
{
}

ThreadManager::~ThreadManager(void)
{
	vThreads.clear();
}

void ThreadManager::Add(Thread * t)
{
	if(!Find(t))
		vThreads.push_back(t);
}

void ThreadManager::Remove(Thread * t)
{	
	vector<Thread*>::iterator iter;
	for( iter = vThreads.begin(); iter != vThreads.end(); ++iter ) 
	{
		if(*iter == t)
		{
			vThreads.erase(iter);
			break;
		}
	}
}

bool ThreadManager::Find(Thread * t)
{
	vector<Thread*>::iterator iter;
	for( iter = vThreads.begin(); iter != vThreads.end(); ++iter ) 
	{
		if(*iter == t)
			return true;
	}
	
	return false;
}

int ThreadManager::getSize(void)
{
	return (int) vThreads.size();
}

void ThreadManager::ClearVector(void)
{
	vThreads.clear();
}

void ThreadManager::setMinimumSize(int s)
{
	vThreads.reserve(s);
}
